#@layout()

#define content()

<div class="container-fluid">
    <div class="row">
        <div class="col-sd-12">
            <div title="#(SystemConst.getDictSystemConst().systemName.dictText??_res.get('system.name'))" class="page-window well">
                <h2 style="text-align: center;">#(SystemConst.getDictSystemConst().systemName.dictText??_res.get('system.name'))</h2>
                <br>

                #if(notBlank(message))
                <div class="alert alert-danger">
                    <button class="close" data-dismiss="alert">
                        ×
                    </button>
                    <i class="fa-fw fa fa-times"></i>
                    <strong>Error!</strong> #(message)
                </div>
                #end

                <form id="loginForm" action="#(ctx)/user/doLogin" onsubmit="return login();"
                      method="post" autocomplete="off">
                    <table class="table">
                        <tr>
                            <td>#(_res.get('user.form.username'))</td>
                            <td><input type="text" name="user.user_name" id="username"/>
                            </td>
                        </tr>
                        <tr>
                            <td>#(_res.get('user.form.password'))</td>
                            <td><input type="password" name="user.pwd" id="pwd"/>
                            </td>
                        </tr>
                        <tr>
                            <td>验证码</td>
                            <td>
                                <input type="text" name="imgcode" id="imgcode" style="width: 110px;margin-right: 2px;"/>
                                <img src="#(ctx)/captcha" alt="点击图片更新验证码" style="height: 25px;cursor: pointer;">
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align: center;">
                                <br>
                                <input type="submit" value="登录" class="btn btn-warning btn-block">
                            </td>

                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>

#end


#define css()
<style type="text/css">
    body {
        background-image: url("#(ctx)/static/img/login-bg.png");
        background-attachment: fixed;
        background-repeat: no-repeat;
        background-size: cover;
        -moz-background-size: cover;
        -webkit-background-size: cover;
    }

    .page-window {
        width: 450px;
        margin: 10% auto;
        background-color: #474747;
        opacity: 0.8;
        color: #ffffff;
    }

    .page-window input {
        color: #000000;
    }
</style>

#end


#define js()
<script type="text/javascript" src="#(ctx)/static/js/crypto-js.js"></script>

<script type="text/javascript">

    $(function () {
        if (window != top) {
            top.location.href = location.href;
        }

        $('img').on('click', function () {
            $.get(contextRootPath + '/captcha');
            // 设置节点属性的值
            $(this).attr('src', contextRootPath + '/captcha?'+new Date().getTime());
        });
    });

    function login() {
        var username = $("#username");
        var password = $("#pwd");
        var flag = false;

        if (username.val() === '') {
            $.messager.alert("警告", "用户名不能为空");
        } else if (password.val() === '') {
            $.messager.alert("警告", "密码不能为空");
        } else {
            flag = true;
            $("#pwd").val(CryptoJS.MD5($("#pwd").val()));
        }

        return flag;
    }
</script>

#end



